<template>
  <div>
    <el-container>
      <el-main>
        <el-row>
          <el-col :span="6" v-for="(item, index) in systemlist" :key="index">
            <el-card
              style="width: 360px"
              shadow="hover"
              @click.native="gotosystem(item.url)"
            >
              <img
                :src="require('../images/' + item.imgurl + '.jpg')"
                style="width: 320px"
              />
              <!-- <div style="padding: 14px">
            <span>好吃的汉堡</span>
            <div class="bottom clearfix">
              <time class="time">{{ currentDate }}</time>
              <el-button type="text" class="button">操作按钮</el-button>
            </div>
          </div> -->
            </el-card>
          </el-col>
        </el-row>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      systemlist: [],
    };
  },
  created() {
    this.getsystem();
  },
  methods: {
    gotosystem(url) {
      this.$router.push(url);
      console.log(url);
    },

    getsystem() {
      console.log(sessionStorage.getItem("userid"))
     
      const loading = this.$loading({
        lock: true,
        text: "正在根据您的权限准备应用",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      if (sessionStorage.getItem("userid") != null) {
        console.log(sessionStorage.getItem("userid"));
        let datas = {
          id: sessionStorage.getItem("userid"),
        };
        this.$axios
          .post("api/member/getsystem", datas)
          .then((response) => {
            this.systemlist = response.data;
          })
          .catch(function (error) {
            console.log(error);
          });

        loading.close();
        
        return;
      } else {
        setTimeout(() => {
          this.getsystem();
        }, 100);
      }
    },
  },
};
</script>

<style>
</style>